package org.zhang.shortlink.project.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import org.zhang.shortlink.project.dao.entity.ShortLinkDO;
import org.zhang.shortlink.project.dto.req.ShortLinkCreateDTO;
import org.zhang.shortlink.project.dto.req.ShortLinkPageDTO;
import org.zhang.shortlink.project.dto.req.ShortLinkUpdateDTO;
import org.zhang.shortlink.project.dto.resp.ShortLinkCreateVO;
import org.zhang.shortlink.project.dto.resp.ShortLinkGroupCountVO;
import org.zhang.shortlink.project.dto.resp.ShortLinkPageVO;

import java.io.IOException;
import java.util.List;

/**
* @author zhang
* @description 针对表【t_link】的数据库操作Service
* @createDate 2024-04-08 20:33:12
*/
public interface ShortLinkService extends IService<ShortLinkDO> {

    /**
     * 创建短链接
     */
    ShortLinkCreateVO saveShortLink(ShortLinkCreateDTO requestParam);

    /**
     * 分页查询短链接
     */
    IPage<ShortLinkPageVO> pageShortLink(ShortLinkPageDTO requestParam);

    /**
     * 根据gid列表获取分组中的短链接数
     */
    List<ShortLinkGroupCountVO> listCountGroup(List<String> requestParam);

    /**
     * 修改短链接
     */
    Void updateShortLink(ShortLinkUpdateDTO requestParam);

    /**
     * 短链接跳转
     */
    void restoreUrl(String shortLink, ServletRequest request, ServletResponse response) throws IOException;


}
